Skip to content

(wip) BUG: groupby with sort=False create buggy multiindex #32506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Mar 6, 2020

Still messy, just running this through the test suite as my laptop's not great (but please let me know if such behaviour is unwelcome and I won't do it again)

pandas/tests/groupby/test_timegrouper.py
pandas/tests/groupby/test_grouping.py
pandas/tests/groupby/test_categorical.py
pandas/tests/groupby/test_groupby.py
pandas/tests/test_multilevel.py

# GH 17537
grouped = mframe.groupby(level=0, sort=sort)
exp_labels = np.array(labels, np.intp)
exp_labels = np.array([2, 2, 2, 0, 0, 1, 1, 3, 3, 3], np.intp)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am deliberately changing the codes, so IMO it's right to change this test as well

Comment on lines +283 to +285
if len(all_codes) > 1 or not isinstance(
ping.grouper, (Categorical, CategoricalIndex, BinGrouper)
):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel really uneasy about this special-casing, just seeing if it works

@MarcoGorelli
Copy link
Member Author

This is a tough one, I'll come back to it later

@MarcoGorelli MarcoGorelli deleted the issue-32259 branch October 10, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: groupby with sort=False creates buggy MultiIndex
1 participant